home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * Structs.h
- *
- * Public functions, structures and constants
- *
- ****************************************************************************/
-
- #ifndef __STRUCTS__
- #define __STRUCTS__
-
- #include <QDOffscreen.h>
-
- // Sketch colors as RGB colors
-
- #define kRGBBlack {0x0000, 0x0000, 0x0000}
- #define kRGBWhite {0xFFFF, 0xFFFF, 0xFFFF}
-
- #define kRGBRed {0xFFFF, 0x0000, 0x0000}
- #define kRGBGreen {0x0000, 0xFFFF, 0x0000}
- #define kRGBBlue {0x0000, 0x0000, 0xFFFF}
-
- #define kRGBCyan {0x0000, 0xFFFF, 0xFFFF}
- #define kRGBMagenta {0xFFFF, 0x0000, 0xFFFF}
- #define kRGBYellow {0xFFFF, 0xFFFF, 0x0000}
-
- #define kRGBOlive {0x0000, 0x64AF, 0x11B0}
- #define kRGBPurple {0xF2D7, 0x0856, 0x84EC}
- #define kRGBOrange {0xD2D2, 0x7171, 0x4343}
- #define kRGBBrown {0x7A7A, 0x4646, 0x4242}
-
- #define kRGBGray01 {0xF000, 0xF000, 0xF000}
- #define kRGBGray02 {0xE000, 0xE000, 0xE000}
- #define kRGBGray03 {0xD000, 0xD000, 0xD000}
- #define kRGBGray04 {0xC000, 0xC000, 0xC000}
- #define kRGBGray05 {0xB000, 0xB000, 0xB000}
- #define kRGBGray06 {0xA000, 0xA000, 0xA000}
- #define kRGBGray07 {0x9000, 0x9000, 0x9000}
- #define kRGBGray08 {0x8000, 0x8000, 0x8000}
- #define kRGBGray09 {0x7000, 0x7000, 0x7000}
- #define kRGBGray10 {0x6000, 0x6000, 0x6000}
- #define kRGBGray11 {0x5000, 0x5000, 0x5000}
- #define kRGBGray12 {0x4000, 0x4000, 0x4000}
- #define kRGBGray13 {0x3000, 0x3000, 0x3000}
- #define kRGBGray14 {0x2000, 0x2000, 0x2000}
- #define kRGBGray15 {0x1000, 0x1000, 0x1000}
- #define kRGBGray16 {0x0001, 0x0001, 0x0001}
-
- // Sketch enums used in the 'aete' resource
-
- #define eBlack 'BLAC'
- #define eWhite 'WHIT'
-
- #define eRed 'RED '
- #define eGreen 'GREE'
- #define eBlue 'BLUE'
-
- #define eCyan 'CYAN'
- #define eMagenta 'MAGE'
- #define eYellow 'YELL'
-
- #define eOlive 'OLIV'
- #define ePurple 'PURP'
- #define eOrange 'ORAN'
- #define eBrown 'BROW'
-
- #define eGray01 'GR01'
- #define eGray02 'GR02'
- #define eGray03 'GR03'
- #define eGray04 'GR04'
- #define eGray05 'GR05'
- #define eGray06 'GR06'
- #define eGray07 'GR07'
- #define eGray08 'GR08'
- #define eGray09 'GR09'
- #define eGray10 'GR10'
- #define eGray11 'GR11'
- #define eGray12 'GR12'
- #define eGray13 'GR13'
- #define eGray14 'GR14'
- #define eGray15 'GR15'
- #define eGray16 'GR16'
-
- #ifndef topLeft
- #define topLeft(r) (((Point *) &(r))[0])
- #endif
-
- #ifndef botRight
- #define botRight(r) (((Point *) &(r))[1])
- #endif
-
- #ifndef max
- #define max(a, b) (((a) > (b)) ? (a) : (b))
- #endif
-
- #ifndef min
- #define min(a, b) (((a) < (b)) ? (a) : (b))
- #endif
-
- // --------------------------------------------------------------------------
-
- typedef enum StructureTypes
- {
- kDocumentRecordID = '*DOC',
- kElementRecordID = '*ELM',
-
- kDocumentListID = '#DOC',
- kElementListID = '#ELM'
- } StructureType;
-
- // --------------------------------------------------------------------------
-
- typedef enum DocumentTypes
- {
- kInvalidDocument = 'XXXX',
- kEtchDocument = 'ETCH'
- } DocumentType;
-
- // --------------------------------------------------------------------------
-
- typedef enum ElementTypes
- {
- kQDLine = 'LINE',
- kQDRect = 'RECT',
- kQDRoundRect = 'ROUN',
- kQDOval = 'OVAL',
- kQDPolygon = 'POLY',
- kGroup = 'GRUP',
- kUnknownElement = 'XXXX'
- } ElementType;
-
- #pragma mark -
- // ------------------------------------------------------------------------------------------------------------
-
- #if powerc
- #pragma options align=power
- #endif
-
-
- // -------------------------------------------------------------------------------------------
- // Utility structs
- // -------------------------------------------------------------------------------------------
-
- typedef struct DrawingState
- {
- WindowPtr window;
- PenState penState;
- RGBColor foreColor;
- RGBColor backColor;
- } DrawingState;
-
- // -------------------------------------------------------------------------------------------
- // ELEMENTS
- // -------------------------------------------------------------------------------------------
-
- typedef struct StrokeRecord
- {
- StructureType structID;
- RGBColor rgbColor;
- short penWidth;
- short penHeight;
- } StrokeRecord;
-
- typedef struct FillRecord
- {
- StructureType structID;
- RGBColor rgbColor;
- } FillRecord;
-
-
- typedef struct ElementRecord
- {
- StructureType structID;
- unsigned long elementNumber; // unqiuely identifies each element within each element list
- struct ElementRecord **next; // reference to next element in list, or nil if last ad
- struct ElementRecord **previous; // reference to previous element in list, or nil if first ad
- struct ElementRecord **subElementList; // reference to sub element, or nil if none
- ElementType elementType; // type of element
- Rect boundingBox; // bounding box in window coordinates
- Point roundRectOvalSize; // width & height of oval used to create round corners
- Point line[2]; // start and stop points for a line
- PolyHandle polygon; // polygon data
- StrokeRecord strokeInfo; // stroke data
- FillRecord fillInfo; // fill data
- } ElementRecord, **ElementReference;
-
- typedef ElementReference ElementList;
-
- // -------------------------------------------------------------------------------------------
- // DOCUMENTS
- // -------------------------------------------------------------------------------------------
-
- typedef struct DocumentRecord
- {
- StructureType structID; // x defines type of structure for debugging and run-time type checking
- unsigned long documentNumber; // x sequential document number, for debugging only
- DocumentType documentType; // • Ad, Text, Picture, TIFF, etc
- Str63 documentName; // • document name, always accurate!
-
- struct DocumentRecord **next; // x reference to next document
- struct DocumentRecord **previous; // x reference to previous document
-
- unsigned short numberOfChanges; // x zero if no changes by user, else number of changes user has made
-
- WindowPtr window; // x window reference
- ElementList elementList;
- short maxWidth; // x maximum width of document
- short maxHeight; // x maximum height of document
- } DocumentRecord, **DocumentReference;
-
- typedef DocumentReference DocumentList;
-
- #if powerc
- #pragma options align=reset
- #endif
-
- #endif
-